import { do_std, do_ready, do_test } from './ready';
import { g_state } from 'db/state';

let old_st = "";

const do_step = (step, umd, watch) => {
    if (!umd || !watch) {
        return;
    }

    const st = g_state();

    if (st !== old_st) {
        console.log(st);
        old_st = st;
    }

    if (st === "ready") {
        do_ready(step, umd, watch);
        return;
    }

    if (st === "test") {
        do_test(step, umd, watch);
        return;
    }

    if (st === "std") {
        do_std(step, umd, watch);
        return;
    }

    watch.startWatch();
};

export {do_step};
